metavistfandomcom-20200214-history
Working With Git
(Quick note before getting started: remember that the gitblit server has to be up, AND you have to be connected to the UNT network. If you need to connect to the UNT VPN, check Connecting to the UNT VPN .) Pulling Changes Everyday before you start work, you need to talk to your team members to see if they have pushed any changes to the repository, and if they have, you need to pull them. There are many ways to pull changes, but I am going to talk about how to pull using the interface provided in Visual Studio, and pulling with git bash. To pull changes with Visual Studio, simply click on the arrow pointing down on the toolbar while WebMetaVist is highlighted in the solution explorer. This will show the "Pull" popup. Next, simply click the "Pull" button in the bottom right hand corner. If you have conflicts (you have edited a file that someone else has edited) you have two options: stash changes, or solve conflicts. If you want to keep your changes, you will need to "Solve Conflicts," which will involve merging the two files. This is a bit of a messy process, so we generally recommend two users NOT editing the same file. The other option is to stash changes, which reverts all changes in a file to those found in the repository. Do this when you have made changes accidentally, or your changes are easy to make again. After stashing your changes, they can be added to your local repository again (so if you edit a file that is NOT updated in the pull, it is stashed and then added back to your local repository). Comitting/Pushing Changes To Commit changes to your local repository, simply click the "Commit" button on the toolbar. This will also allow you to Commit AND Push your changes at the same time. (Note: A Commit pushes changes to your LOCAL repository. A Push pushes changes to the REMOTE repository that is used by everyone.) After choosing Commit, you will see a list of files to add to the list. Make sure to ONLY highlight files you have specifically edited, and the .suo (solution) file .csproj (c# project) file. DO NOT PUSH ANY .DLL FILES OR ANY FILES FOUND IN /PACKAGES OR /OBJ. After highlighting the files you want to commit/push, hit the "Stage" button. Then, enter a meaningful commit message. Usually the first line is a summary of what changes you have made, followed by a few sentences explaining what you did. Finally, hit "Commit" to push changes locally, or "Commit & Push" to commit changes locally and push them to the repository. Below is an example of a sample commit, without a message. Generally we always "Commit & Push," but there may be times where you commit locally and then need to push to the server. In these cases, after making a commit, you can click the up arrow on the toolbar to push your changes to the repository. A popup will appear. Keep all options the same and choose "Push" to push your changes to the repository.